// -----------------------------------------------------------
// Game Framework
// Copyright © 2024-2024 deadcycle. All rights reserved.
// Homepage: https://deadcycle.gitee.io
// Feedback: deadcycle@163.com
// -----------------------------------------------------------

using UnityEditor;

using UnityEngine;

namespace UIWidget.Editor
{
    [CustomEditor(typeof(VariableScrollRect))]
    public class VariableScrollRectInspector : ScrollRectBaseInspector
    {
        private SerializedProperty m_CellSizes;
        private SerializedProperty m_CellTemplates;
        private SerializedProperty m_UsingObjectPool;

        protected override void OnEnable()
        {
            base.OnEnable();

            m_CellSizes = serializedObject.FindProperty("m_CellSizes");
            m_CellTemplates = serializedObject.FindProperty("m_CellTemplates");
            m_UsingObjectPool = serializedObject.FindProperty("m_UsingObjectPool");
        }

        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
            {
                using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar))
                {
                    GUILayout.Label("<b>不定长视图单元格配置</b>", GUIStyleHelper.Caption);
                }

                EditorGUILayout.PropertyField(m_UsingObjectPool, new GUIContent("使用对象池"), false);
                EditorGUILayout.PropertyField(m_CellSizes, new GUIContent("单元格尺寸列表"), true);
                EditorGUILayout.PropertyField(m_CellTemplates, new GUIContent("单元格模板列表"), true);

                serializedObject.ApplyModifiedProperties();
            }

            EditorGUILayout.Space(5);

            base.OnInspectorGUI();
        }
    }
}